package com.m3839.sdk.login.utils;

import com.m3839.sdk.common.encrypt.Base64Utils;
import com.m3839.sdk.login.bean.InternalUser;

/**
 * Description:UserUtils
 *
 * @author 陈宝阳
 * @create 2020/9/1 09:20
 */
public class UserUtils {

  private static final String SEPARATOR = "|";

  public static String getState(InternalUser user) {

    if (user != null) {
      StringBuilder sb = new StringBuilder();
      sb.append(user.getUserId())
          .append(SEPARATOR)
          .append(user.getType())
          .append(SEPARATOR)
          .append(user.getToken());
      return Base64Utils.encode(sb.toString());
    }

    return "";
  }
}
